package com.byedu.util;

import org.apache.commons.collections4.CollectionUtils;

import java.util.List;

/**
 * Created by jason on 2017/5/29.
 */
public class ArrayUtil {

    public static boolean and(List<Boolean> booleanList) {

        if (CollectionUtils.isNotEmpty(booleanList)){
            if (booleanList.size() == 1) {
                return booleanList.get(0);
            } else if (booleanList.size() > 1) {
                boolean result = booleanList.get(0);
                for (boolean check : booleanList) {
                    result = result && check;
                }

                return result;
            }
        }

        return false;
    }

}
